package physics;

import java.awt.event.ActionEvent;

import physics.Collisions.Collision;
import physics.MovementControl.JumperMovementController;

import common.Math3D;
import common.Point3D;

public class Knife extends Weapon {

	double jumpStrength = 0.2;
	
	public Knife(){
		ticksToDisappear = 200;
		this.setMovementControler(new JumperMovementController(this));
		this.getMovementControler().setMovementLimit(0.5);
	}
	
	public void impact(Collision c){
		GameObject bumpedInto;	
		if (c.getObj1().equals(this))
			bumpedInto= c.getObj2();
		else
			bumpedInto = c.getObj1();
		
		switch (c.getType()){
//			case AVATAR:
//				//this.exists = false;
//				break;
			case DEFAULT:
				if (!(bumpedInto instanceof GiantRobot)){
					getMovementControler().restoreLastPosition();
					getMovementControler().setHasMomentum(false);
				}
				break;
		}
	}
	
	

	public void jump(){
		jump(jumpStrength);
		disappearing = true;
		ticks = 0;
	}
	
	
	private void jump(double strength){
		this.getMovementControler().addMovement(
				Math3D.scalePoint(getUp(), strength));
		this.getMovementControler().addMovement(
				Math3D.scalePoint(getFace(), strength ));
	}
	
}
